﻿@model MVC4.Presentation.Models.LoginModel

 @{
     int loginStatus = (int)ViewBag.loginStatus;
 }
<div id="login-box" class="item login-box"     ng-class="{active: activePanel==1}"   >
	<div class="widget-body">
		<div class="widget-main">
			<h4 class="header blue lighter bigger">
				<i class="icon-coffee green"></i>
				Please Enter Your Information
			</h4>

			<div class="space-6"></div>

			@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { name = "loginForm", novalidate = "" }))
   {
                @Html.AntiForgeryToken()
				<fieldset>
                    <div class="control-group "  ng-class="{error: loginForm.UserName.$error.required && loginModel.send}"       >
                        @Html.LabelFor(m => m.UserName, new { @class = "control-label" })  
					<div class="controls">
						<span class="span11 input-icon input-icon-right">
                            <input class="span12 "     id="UserName" name="UserName"  ng-model="loginModel.UserName" type="text" required  />
							<i      ng-class="{true:'icon-remove-sign',false:'icon-user'  }[loginForm.UserName.$error.required&&loginModel.send]" ></i>
						</span>
						<span class="help-inline" ng-show="loginForm.UserName.$error.required&&loginModel.send">Something may have gone wrong   </span>
					</div>
				  </div>
                    <div class="control-group " ng-class="{error: loginForm.Password.$error.required&&loginModel.send }">
                        @Html.LabelFor(m => m.Password, new { @class = "control-label" })
					<div class="controls">
						<span class="span11 input-icon input-icon-right">
                             <input class="span12"   id="Password" name="Password"  ng-model="loginModel.Password" type="password"  required />
                            <i     ng-class="{true:'icon-remove-sign',false:'icon-lock'  }[loginForm.Password.$error.required&&loginModel.send]"   ></i>
						</span>
                        <br />
                        <br />
						<div class="help-block"  ng-show="loginForm.Password.$error.required&&loginModel.send">Please correct the error  </div>
					</div>
				</div>

				<div class="space"></div>

				<div class="row-fluid">
					<label class="span8">
                            <input   id="RememberMe" name="RememberMe" type="checkbox"  ng-model="loginModel.RememberMe" value="{{loginModel.RememberMe}}">
							<span class="lbl">  Remember me</span>
					</label>
                          
					<button    class="span4 btn btn-small btn-primary" ng-click="submit(loginForm,$event,'loginModel')"  >
						<i class="icon-key"></i>
						Login 
					</button>
				</div>
                <div class="alert alert-error" ng-show="!loginForm.$valid&&loginModel.send ">
					<button type="button" class="close" data-dismiss="alert">
						<i class="icon-remove"></i>
					</button>
                       Change a few things up and try submitting again. 
				</div>
                <div class="alert alert-error" ng-show=" (@loginStatus<2&&loginForm.$pristine )">
					<button type="button" class="close" data-dismiss="alert">
						<i class="icon-remove"></i>
					</button>
                      @ViewBag.loginMessage 
				</div>
			</fieldset>
   }
		</div><!--/widget-main-->

		<div class="toolbar clearfix carousel-caption">
			<div>
				<a href="#" onclick="$('#zCarousel').carousel('prev'); return false;" class="forgot-password-link">
					<i class="icon-arrow-left"></i>
					I forgot my password
				</a>
			</div>

			<div>
				<a href="#" onclick="$('#zCarousel').carousel('next'); return false;" class="user-signup-link">
					I want to register
					<i class="icon-arrow-right"></i>
				</a>
			</div>
		</div>
	</div><!--/widget-body-->
</div><!--/login-box-->